package com.jinmdz.fmis.mapper.mapper;

import org.apache.ibatis.annotations.*;
import com.jinmdz.fmis.mapper.mapper.provider.MournHallDoorProvider;
import com.jinmdz.fmis.mapper.entity.MournHallDoorEntity;

import java.util.ArrayList;

/**
 * 礼厅与自动门信息关联表Mapper
 * 
 * @author generator
 * @date 2020-08-23 18:11
 */
public interface MournHallDoorMapper {

    /**
     * 增加MournHallDoor
     * 
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @InsertProvider(type = MournHallDoorProvider.class, method = "insertMournHallDoor")
    @Options(useGeneratedKeys = true, keyProperty = "entity.id", keyColumn = "id")
    void insertMournHallDoor(@Param("entity") MournHallDoorEntity entity);

    /**
     * 删除MournHallDoor
     * 
     * @param id 主键
     * @param modifiedUserId 修改用户外键
     * @param version 版本号
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @Update(" update mourn_hall_door set deleted = 1,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void deletedForMournHallDoor(@Param("id") Integer id, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

    /**
     * 修改MournHallDoor
     * 
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @UpdateProvider(type = MournHallDoorProvider.class, method = "updateMournHallDoor")
    void updateMournHallDoor(@Param("entity") MournHallDoorEntity entity);

    /**
     * 查询MournHallDoor实体
     * 
     * @param id 主键
     * @return MournHallDoorEntity
     * @author generator
     * @date 2020-08-23 18:11
     */
    @Select(" select id,deleted,hall_id,door_number,ip_address,port_number,account,password,as_in,as_out,funeral_parlour_code,create_user_id,gmt_create,unmodified,modified_user_id,gmt_modified,version from mourn_hall_door where id = #{id} and deleted = 0 limit 1 ")
    MournHallDoorEntity getMournHallDoorById(@Param("id") Integer id);

    /**
     * 查询MournHallDoor列表
     * 
     * @param entity 数据实体
     * @return MournHallDoorEntity
     * @author generator
     * @date 2020-08-23 18:11
     */
    @SelectProvider(type = MournHallDoorProvider.class, method = "listMournHallDoor")
    ArrayList<MournHallDoorEntity> listMournHallDoor(@Param("entity") MournHallDoorEntity entity);
}